# -*- coding: utf-8 -*-

from django.db import models

from django_package.application.choices import DF_TYPE_CHOICE


class BaseModel(models.Model):
    objects = models.Manager()

    # create_time = models.DateTimeField()
    # update_time = models.DateTimeField()

    class Meta:
        abstract = True
        pass


class TableModel(BaseModel):
    objects = models.Manager()

    t_code = models.CharField(max_length=8, verbose_name='编码', )
    t_user = models.CharField(max_length=16, verbose_name='用户', )

    class Meta:
        managed = False
        db_table = 'drf_table'
        verbose_name = 'TableModel'
        verbose_name_plural = verbose_name
        pass

    pass


class DataFrameModel(BaseModel):
    df_code = models.CharField(max_length=8, verbose_name='编码', )
    df_name = models.CharField(max_length=64, verbose_name='名称', )

    df_type = models.CharField(max_length=16, verbose_name='类型', choices=DF_TYPE_CHOICE)
    df_user = models.CharField(max_length=16, verbose_name='用户', )

    df_date = models.DateField(verbose_name='日期', )

    df_integer = models.IntegerField(verbose_name='数量', )
    df_decimal = models.DecimalField(max_digits=16, decimal_places=4, verbose_name='数值', )

    df_datetime = models.DateTimeField(verbose_name='时间', )

    class Meta:
        db_table = 'drf_data_frame'
        verbose_name = 'DataFrameModel'
        verbose_name_plural = verbose_name
        pass

    pass


class ExampleModel(BaseModel):
    id = models.AutoField(primary_key=True, verbose_name='主键')
    name = models.CharField(unique=True, null=False, blank=False, max_length=16, verbose_name='名称')
    status = models.BinaryField(verbose_name='状态')

    class Meta:
        db_table = 'drf_example'
        verbose_name = 'drf_example'
        verbose_name_plural = verbose_name
